package com.ym.medical.dao;

import com.ym.medical.domain.entity.ConsumeDetailsEntity;
import com.ym.medical.domain.param.AccountStatementParam;
import com.ym.medical.domain.param.ConsumeDetailsParam;
import com.ym.medical.domain.param.DocConsumeDetailParam;
import com.ym.medical.domain.param.DoctorConsumeDetailParam;
import com.ym.medical.domain.param.PlatformAccountExampleParam;
import com.ym.medical.domain.vo.AccountStatementVO;
import com.ym.medical.domain.vo.ConsumeDetailsVo;
import com.ym.medical.domain.vo.DoctorBillDetailVo;
import com.ym.medical.domain.vo.DoctorConsumeDetailVO;
import com.ym.medical.domain.vo.DoctorTdDetailsVO;
import com.ym.medical.domain.vo.PCconsumeVo;
import com.ym.medical.domain.vo.StudioTransactionVo;
import com.ym.medical.domain.vo.TdDetailSummaryVO;
import com.ym.medical.domain.vo.UserExpendIncomeVO;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import tk.mybatis.mapper.common.Mapper;

import java.util.Date;
import java.util.List;

/**
 * 仅包含消费/退费交易记录Dao接口
 *
 * @author ym
 * @date 2020-08-24
 */
@Repository
public interface ConsumeDetailsDao extends Mapper<ConsumeDetailsEntity> {

	UserExpendIncomeVO patientExpendIncome(@Param("patientId") Long patientId, @Param("tdTime") String tdTime);

	UserExpendIncomeVO doctorExpendIncomeVO(@Param("doctId") Long doctId,@Param("tdTime")  String tdTime);

	/**
	 * 医生账单管理-医生的收入支出记录
	 * @param doctorConsumeDetailVO
	 * @return
	 */
	List<DoctorConsumeDetailVO> listDoctorExpendDetail(DoctorConsumeDetailParam doctorConsumeDetailVO);

	/**
	 * 账户信息
	 * @param userId
	 * @return
	 */
	PCconsumeVo getPatientAccount(Long userId);

	/**
	 * 交易明细列表
	 * @param consumeModel
	 * @return
	 */
	List<ConsumeDetailsEntity> getConsumeDetails(ConsumeDetailsParam consumeModel);

	/**
	 * 用户的交易明细
	 * @param userId
	 * @param tdTime
	 * @return
	 */
	List<DoctorTdDetailsVO> userTransactionDetail(@Param("userId")Long userId, @Param("tdTime")String tdTime);

	/**
	 * 查询医生的交易明细
	 * @param userId
	 * @param tdTime
	 * @return
	 */
	List<DoctorTdDetailsVO> docTransactionDetail(@Param("userId")Long userId,@Param("tdTime")String tdTime);

	/**
	 * 查询该用户本年度个个月的收支情况
	 * @param accountStatementVO
	 * @return
	 */
	List<AccountStatementVO> listGroupByMonth(AccountStatementParam accountStatementVO);

	/**
	 * PC端查询患者的交易明细
	 * @param consumeDetailsModel
	 * @return
	 */
	List<ConsumeDetailsVo> listPatientConsumeDetail(ConsumeDetailsParam consumeDetailsModel);

	/**
	 * PC端-账务系统 平台账户交易汇总
	 * @param startTime
	 * @param endTime
	 * @return
	 */
	TdDetailSummaryVO tdDetailSummary(@Param("cashFlow")String cashFlow, @Param("startTime") Date startTime, @Param("endTime") Date endTime);

	/**
	 * PC端-账务系统-平台账务管理 医生消费收入记录管理
	 * @param platformAccountExampleVO
	 */
	List<ConsumeDetailsEntity> listDocIncomeRecord(PlatformAccountExampleParam platformAccountExampleVO);

	/**
	 * 修改消费明细表中系统出账主键
	 * @param consumeDetailsModel
	 * @param ids
	 */
	int updateBatchById(@Param("model") ConsumeDetailsParam consumeDetailsModel, @Param("ids") List<Long> ids);

	/**
	 *  医生工作室交易汇总
	 * @param detailsModel
	 * @return
	 */
	List<StudioTransactionVo> studioTransaction(ConsumeDetailsParam detailsModel);

	/**
	 * 清除系统出账主键
	 * @param auditIds
	 */
	void clearSysAuditId(@Param("auditIds") Long[] auditIds);

	/**
	 * 获取医生账单详情
	 * @param docConsumeDetailDTO
	 * @return
	 */
	List<DoctorBillDetailVo> getDoctorBillDetailVo(DocConsumeDetailParam docConsumeDetailDTO);
}
